
string file = getenv("TMP1");

void pid0(){
  TFile *f = new TFile(file.c_str(), "UPDATE");
  TTree *etf = (TTree *)f->Get("etf");
  TCut cut = "";

  // --------------------- 16. Tstop Statistics ----------------------- //
  etf->Draw("tstop.time()-tstart2.time()>>h1(5000, 0., 100.)", cut);
  etf->Draw("rawvme0.adc(0,4):tstop.time()-tstart2.time()>>h2(5000, 0., 80., 1000, 0., 4200.)", cut);
  etf->Draw("rawvme0.adc(0,5):tstop.time()-tstart2.time()>>h3(5000, 0., 80., 1000, 0., 4200.)", cut);
  etf->Draw("rawvme0.adc(0,6):tstop.time()-tstart2.time()>>h4(5000, 0., 80., 1000, 0., 4200.)", cut);
  etf->Draw("rawvme0.adc(0,7):tstop.time()-tstart2.time()>>h5(5000, 0., 80., 1000, 0., 4200.)", cut);
  etf->Draw("(rawvme0.adc(0,4)+rawvme0.adc(0,5)+rawvme0.adc(0,6)+rawvme0.adc(0,7))/4.:tstop.time()-tstart2.time()>>h6(5000, 0., 80., 1000, 0., 4200.)", cut);

  TCanvas *c1 = new TCanvas("c", "Tstop Statistics", 1680, 1050);
  c1->Divide(3,2); char h[64]; TH1 *b;
  for(int i = 0; i < 6; i++){
    sprintf(h, "h%d", i+1); f->GetObject(h,b);
    c1->cd(i+1); b->Draw("colz");
  } // end for
  c1->Print("pid0.pdf");
} // end vis
